import 'package:flutter/material.dart';

// ignore: must_be_immutable
class ListViewItemContainer extends StatelessWidget {
  ListViewItemContainer({
    Key? key,
    this.backgroundColor = Colors.white,
    this.highlightColor,
    required this.child,
    this.borderRadius,
    this.padding = EdgeInsets.zero,
    this.disableHighlightEffects = false,
    bool disableHoverEffects = false,
    this.hoverBackgroundColor,
    this.onPressed,
    this.shapeBorder,
  }) : super(key: key) {
    if (this.hoverBackgroundColor == null) {
      if (disableHoverEffects /* ||
          NWWebPlatform.isAndroidWeb ||
          NWWebPlatform.isIOSWeb*/
      ) {
        this.hoverBackgroundColor = this.backgroundColor;
      }
    }
  }

  final Widget child;
  final BorderRadius? borderRadius;
  final Color backgroundColor;
  final Color? highlightColor;
  final bool disableHighlightEffects;
  Color? hoverBackgroundColor;
  final VoidCallback? onPressed;
  final EdgeInsetsGeometry padding;
  final OutlinedBorder? shapeBorder;

  ButtonStyle _buildStyle() {
    return ElevatedButton.styleFrom(

    );
  }


  @override
  Widget build(BuildContext context) {
    var _bs = ButtonStyle(
      padding: MaterialStateProperty.all(this.padding),
      minimumSize: MaterialStateProperty.all(Size.fromHeight(48.0)),
      shape: MaterialStateProperty.all(
          this.shapeBorder ?? RoundedRectangleBorder()),
      elevation: MaterialStateProperty.all(0.0),
      backgroundColor: MaterialStateProperty.resolveWith((states) {
        if (states.contains(MaterialState.pressed)) {
          if (!this.disableHighlightEffects) {
            return this.highlightColor;
          }
        }
        return this.backgroundColor;
      }),
      overlayColor: MaterialStateProperty.resolveWith((states) {
        if (states.contains(MaterialState.hovered)) {
          return this.hoverBackgroundColor;
        } else if (states.contains(MaterialState.pressed)) {
          return Colors.transparent;
        } else if (states.contains(MaterialState.disabled)) {
          return this.backgroundColor;
        }
      }),
    );
    Widget content = ElevatedButton(
      style: _bs,
      child: this.child,
      onPressed: this.onPressed,
    );

    if (borderRadius != null) {
      content = ClipRRect(
        borderRadius: borderRadius!,
        child: content,
      );
    }

    return Container(
      color: this.backgroundColor,
      child: content,
    );
  }
}
